import {
  Column,
  CreateDateColumn,
  Entity,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity({ name: 'tb_tokens' })
export class Token {
  @PrimaryGeneratedColumn({
    type: 'int',
    name: 'token_id',
    comment: 'Token ID',
  })
  tokenId: number;

  @Column({
    name: 'user_id',
    type: 'varchar',
    length: 36,
    nullable: true,
    comment: '用户ID，是uuid',
  })
  userId: string;

  @Column({
    name: 'token',
    type: 'text',
    comment: '用户登录token',
  })
  token: string;

  @UpdateDateColumn({
    name: 'updated_at',
    type: 'timestamp',
    comment: '更新时间',
  })
  updatedAt: number;

  @CreateDateColumn({
    name: 'created_at',
    type: 'timestamp',
    comment: '创建时间',
  })
  createdAt: number;
}
